package com.example.administrator.myapplication;

import android.app.Application;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

/**
 * Created by Administrator on 2019/3/18.
 */

public class MyActivity  extends AppCompatActivity{
   EditText mEtUserName;

    Button mBtnNext;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mylayout);

        mBtnNext = findViewById(R.id.btn_next);


        //设置点击事件
        mBtnNext.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //神奇的跳转  意图
                Intent intent=new Intent( MyActivity.this,MyActivity2.class);

                //在意图中携带数据
                Bundle bundle=new Bundle();
                //修改用户输入
                //获取控件，从控件中读取数据
               String username = mEtUserName.getText().toString();

                bundle.putString("username",username);
                bundle.putString("password","123");
                intent.putExtras(bundle);
                //

                startActivity(intent);

            }
        });


    }
}
